<template>
  <div class="breadlist">
    <el-card class="box-card" shadow="hover">
    <el-breadcrumb separator-class="el-icon-arrow-right" style="font-size:15px;">
    <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
    <el-breadcrumb-item v-for="item in getmatched" :key="item.meta.title" :v-if="hidden">{{ item.meta.title }}</el-breadcrumb-item>
    </el-breadcrumb>
  </el-card>
  </div>
</template>

<script>
export default {
    name:'breadlist',
    data(){
      return {
        hidden:true
      }
    },
    computed:{
        getmatched(){
          if(this.$route.path==='/home'||this.$route.path==='/') return this.hidden = true
          else{
          this.hidden = false
          var arr = this.$route.matched.filter(item => item.path!=='')
          if(arr[0].path.includes('/g')){
            arr.unshift({meta:{title:'商品管理'}})
          }else if(arr[0].path.includes('/o')){
            arr.unshift({meta:{title:'订单管理'}})
          }
          return arr
          }
          
        }
    },
}
</script>

<style>
.breadlist{
  margin:10px;
}
</style>